This vignette will show basic functions provided by viewmaster

load greenleaf MPAL dataset into monocle3

mpal<-readRDS(file ="/Volumes/fh/fast/furlan_s/grp/data/ddata/BM_data/healthy_bone_marrow_greenleaf.rds")
plot_cells(mpal, color_cells_by = "BioClassification", label_cell_groups = F)+scale_color_manual(values = sfc(n = 26))

load hca bone marrow seurat object, convert to monocle using viewmaster’s helpful function

hca<-readRDS(file = "/Volumes/fh/fast/furlan_s/grp/data/ddata/BM_data/palantir_bm_r1.rds")
hca<-seurat_to_monocle3(hca, seu_rd = "tsne")
plot_cells(hca , color_cells_by = "cell_annotation", label_cell_groups = F)+scale_color_manual(values = sfc(10, scramble = F))

Detect common variant genes between two cell data sets

vg<-common_variant_genes(mpal, hca, top_n = 5000)

Use softmax regression for viewmaster. We will use the Greenleaf lab’s MPAL healthy bone marrow cell annotations and transfer them to Human Cell Atals of bone marrow

view<-viewmaster(ref_cds  = mpal, query_cds = hca, ref_celldata_col = "BioClassification", selected_genes = vg, verbose=T, FUNC = "softmax_regression", tf_idf = F)

plot_cells(view, color_cells_by = "smr_celltype", label_cell_groups = F)+scale_color_manual(values = sfc(11))

logistic regression matrix

hca_seu<-monocle3_to_seurat(hca)
mpal_seu<-monocle3_to_seurat(mpal, mon_rd = "UMAP")

log_mat<-log_reg_matrix(trainDat = mpal_seu, testDat = hca_seu, trainClass = "BioClassification", testClass = "cell_annotation", downsample = 500)

testDat<- loadTrainingData(hca_seu)

clusterPreds = apply(log_mat,2,function(e) sapply(split(e,testDat$mDat[["cell_annotation"]]),mean))

#Convet to percentages
clusterPreds = (1+exp(-clusterPreds))**-1

pheatmap(clusterPreds, cluster_cols=T,cluster_rows = T ,col = ArchR::paletteContinuous("coolwarm", n=10, reverse = F), border_color = "black")

session_info()
## R version 4.1.0 (2021-05-18)
## Platform: x86_64-apple-darwin17.0 (64-bit)
## Running under: macOS Big Sur 10.16
## 
## Locale: en_US.UTF-8 / en_US.UTF-8 / en_US.UTF-8 / C / en_US.UTF-8 / en_US.UTF-8
## 
## Package version:
##   abind_1.4-5                 annotate_1.70.0            
##   AnnotationDbi_1.54.1        ArchR_1.0.1                
##   askpass_1.1                 assertthat_0.2.1           
##   backports_1.4.1             base64enc_0.1-3            
##   batchelor_1.10.0            beachmat_2.10.0            
##   beeswarm_0.4.0              BH_1.78.0.0                
##   Biobase_2.54.0              BiocFileCache_2.0.0        
##   BiocGenerics_0.40.0         BiocIO_1.2.0               
##   BiocNeighbors_1.12.0        BiocParallel_1.28.3        
##   BiocSingular_1.10.0         biomaRt_2.48.3             
##   Biostrings_2.60.2           bit_4.0.4                  
##   bit64_4.0.5                 bitops_1.0-7               
##   blob_1.2.3                  boot_1.3-28                
##   brio_1.1.3                  BSgenome_1.60.0            
##   bslib_0.4.0                 cachem_1.0.6               
##   Cairo_1.6.0                 callr_3.7.1                
##   caTools_1.18.2              checkmate_2.1.0            
##   chromVAR_1.14.0             circlize_0.4.15            
##   class_7.3.20                classInt_0.4.7             
##   cli_3.3.0                   clipr_0.8.0                
##   clue_0.3.61                 cluster_2.1.3              
##   CNEr_1.28.0                 codetools_0.2-18           
##   colorspace_2.0-3            commonmark_1.8.0           
##   compiler_4.1.0              ComplexHeatmap_2.8.0       
##   cowplot_1.1.1               cpp11_0.4.2                
##   crayon_1.5.1                crosstalk_1.2.0            
##   curl_4.3.2                  data.table_1.14.2          
##   datasets_4.1.0              DBI_1.1.3                  
##   dbplyr_2.2.1                DelayedArray_0.20.0        
##   DelayedMatrixStats_1.16.0   deldir_1.0-6               
##   desc_1.4.1                  dichromat_2.0-0.1          
##   diffobj_0.3.5               digest_0.6.29              
##   DirichletMultinomial_1.34.0 doMC_1.3.8                 
##   doParallel_1.0.17           dplyr_1.0.9                
##   dqrng_0.3.0                 DT_0.24                    
##   e1071_1.7.11                ellipsis_0.3.2             
##   evaluate_0.16               fansi_1.0.3                
##   farver_2.1.1                fastmap_1.1.0              
##   filelock_1.0.2              fitdistrplus_1.1-8         
##   FNN_1.1.3.1                 fontawesome_0.3.0          
##   foreach_1.5.2               foreign_0.8-82             
##   formatR_1.12                Formula_1.2-4              
##   fs_1.5.2                    furrr_0.3.0                
##   futile.logger_1.4.3         futile.options_1.0.1       
##   future_1.27.0               future.apply_1.9.0         
##   generics_0.1.3              GenomeInfoDb_1.30.1        
##   GenomeInfoDbData_1.2.7      GenomicAlignments_1.28.0   
##   GenomicRanges_1.46.1        GetoptLong_1.0.5           
##   ggbeeswarm_0.6.0            ggplot2_3.3.6              
##   ggrastr_1.0.1               ggrepel_0.9.1              
##   ggridges_0.5.3              glmnet_4.1-4               
##   GlobalOptions_0.1.2         globals_0.16.0             
##   glue_1.6.2                  GO.db_3.13.0               
##   goftest_1.2-3               gplots_3.1.3               
##   graphics_4.1.0              grDevices_4.1.0            
##   grid_4.1.0                  gridExtra_2.3              
##   grr_0.9.5                   gtable_0.3.0               
##   gtools_3.9.3                HDF5Array_1.22.1           
##   hdf5r_1.3.5                 here_1.0.1                 
##   highr_0.9                   Hmisc_4.7-0                
##   hms_1.1.1                   htmlTable_2.4.1            
##   htmltools_0.5.3             htmlwidgets_1.5.4          
##   httpuv_1.6.5                httr_1.4.3                 
##   ica_1.0-3                   igraph_1.3.4               
##   interp_1.1-3                IRanges_2.28.0             
##   irlba_2.3.5                 isoband_0.2.5              
##   iterators_1.0.14            jpeg_0.1-9                 
##   jquerylib_0.1.4             jsonlite_1.8.0             
##   KEGGREST_1.32.0             KernSmooth_2.23-20         
##   knitr_1.39                  labeling_0.4.2             
##   lambda.r_1.2.4              later_1.3.0                
##   lattice_0.20-45             latticeExtra_0.6-30        
##   lazyeval_0.2.2              leiden_0.4.2               
##   leidenbase_0.1.11           lifecycle_1.0.1            
##   limma_3.50.3                listenv_0.8.0              
##   lme4_1.1-30                 lmtest_0.9-40              
##   magrittr_2.0.3              mapproj_1.2.8              
##   maps_3.4.0                  MASS_7.3-58.1              
##   Matrix_1.4-1                Matrix.utils_0.9.8         
##   MatrixGenerics_1.6.0        matrixStats_0.62.0         
##   memoise_2.0.1               methods_4.1.0              
##   mgcv_1.8-40                 mime_0.12                  
##   miniUI_0.1.1.1              minqa_1.2.4                
##   monocle3_1.2.8              motifmatchr_1.14.0         
##   munsell_0.5.0               nabor_0.5.0                
##   nlme_3.1-159                nloptr_2.0.3               
##   nnet_7.3-17                 openssl_2.0.2              
##   pals_1.7                    parallel_4.1.0             
##   parallelly_1.32.1           patchwork_1.1.1            
##   pbapply_1.5-0               pbmcapply_1.5.1            
##   pheatmap_1.0.12             pillar_1.8.0               
##   pkgconfig_2.0.3             pkgload_1.3.0              
##   plogr_0.2.0                 plotly_4.10.0              
##   plyr_1.8.7                  png_0.1-7                  
##   polyclip_1.10-0             poweRlaw_0.70.6            
##   pracma_2.3.8                praise_1.0.0               
##   prettyunits_1.1.1           processx_3.7.0             
##   progress_1.2.2              progressr_0.10.1           
##   promises_1.2.0.1            proxy_0.4.27               
##   ps_1.7.1                    pscl_1.5.5                 
##   purrr_0.3.4                 R.methodsS3_1.8.2          
##   R.oo_1.25.0                 R.utils_2.12.0             
##   R6_2.5.1                    ragg_1.2.2                 
##   RANN_2.6.1                  rappdirs_0.3.3             
##   raster_3.5.21               RColorBrewer_1.1-3         
##   Rcpp_1.0.9                  RcppAnnoy_0.0.19           
##   RcppArmadillo_0.11.2.0.0    RcppArrayFire_0.1.0        
##   RcppEigen_0.3.3.9.2         RcppHNSW_0.4.1             
##   RcppProgress_0.4.2          RcppTOML_0.1.7             
##   RCurl_1.98-1.8              readr_2.1.2                
##   rematch2_2.1.2              reshape2_1.4.4             
##   ResidualMatrix_1.4.0        restfulr_0.0.15            
##   reticulate_1.25             rgeos_0.5-9                
##   rhdf5_2.38.1                rhdf5filters_1.6.0         
##   Rhdf5lib_1.16.0             RhpcBLASctl_0.21.247.1     
##   Rhtslib_1.24.0              rjson_0.2.21               
##   rlang_1.0.4                 rmarkdown_2.14             
##   ROCR_1.0-11                 rpart_4.1.16               
##   rprojroot_2.0.3             rsample_1.1.0              
##   Rsamtools_2.8.0             RSpectra_0.16.1            
##   RSQLite_2.2.15              rstudioapi_0.13            
##   rsvd_1.0.5                  rtracklayer_1.52.1         
##   Rtsne_0.16                  s2_1.1.0                   
##   S4Vectors_0.32.4            sass_0.4.2                 
##   ScaledMatrix_1.2.0          scales_1.2.0               
##   scattermore_0.8             sctransform_0.3.3          
##   scuttle_1.4.0               seqLogo_1.58.0             
##   Seurat_4.1.1                SeuratDisk_0.0.0.9019      
##   SeuratObject_4.1.0          sf_1.0.8                   
##   shape_1.4.6                 shiny_1.7.2                
##   SingleCellExperiment_1.16.0 sitmo_2.0.2                
##   slam_0.1.50                 slider_0.2.2               
##   snow_0.4.4                  sourcetools_0.1.7          
##   sp_1.5-0                    sparseMatrixStats_1.6.0    
##   spatstat.core_2.4-4         spatstat.data_2.2-0        
##   spatstat.geom_2.4-0         spatstat.random_2.2-0      
##   spatstat.sparse_2.1-1       spatstat.utils_2.3-1       
##   spData_2.0.1                spdep_1.2.4                
##   speedglm_0.3.4              splines_4.1.0              
##   stats_4.1.0                 stats4_4.1.0               
##   stringi_1.7.8               stringr_1.4.0              
##   SummarizedExperiment_1.24.0 survival_3.4-0             
##   sys_3.4                     systemfonts_1.0.4          
##   tensor_1.5                  terra_1.6-7                
##   testthat_3.1.4              textshaping_0.3.6          
##   TFBSTools_1.30.0            TFMPvalue_0.0.8            
##   tibble_3.1.8                tictoc_1.0.1               
##   tidyr_1.2.0                 tidyselect_1.1.2           
##   tinytex_0.40                tools_4.1.0                
##   tzdb_0.3.0                  units_0.8.0                
##   utf8_1.2.2                  utils_4.1.0                
##   uwot_0.1.11                 vctrs_0.4.1                
##   viewmaster_1.0              vipor_0.4.5                
##   viridis_0.6.2               viridisLite_0.4.0          
##   vroom_1.5.7                 waldo_0.4.0                
##   warp_0.2.0                  withr_2.5.0                
##   wk_0.6.0                    xfun_0.32                  
##   XML_3.99.0.10               xml2_1.3.3                 
##   xtable_1.8-4                XVector_0.34.0             
##   yaml_2.3.5                  zlibbioc_1.40.0            
##   zoo_1.8-10